{% extends 'TopxiaAdminBundle:User:layout.html.twig' %}

{% block title %}用户管理 - {{ parent() }}{% endblock %}

{% set menu = 'user' %}

{% set script_controller = 'user/list' %}

{% block main %}
<div class="page-header clearfix">
  <button class="btn btn-info btn-sm pull-right" id="add-navigation-btn" data-toggle="modal" data-target="#modal" data-url="{{path('admin_user_create')}}" >添加新用户</button>
  <h1 class="pull-left">用户管理</h1>
</div>
 <form id="user-search-form" class="form-inline well well-sm" action="" method="get" novalidate>
    
    <div class="form-group">
      <select class="form-control" name="roles">
        {{ select_options(dict('userRole'), app.request.query.get('roles'), '--所有角色--') }}
      </select>
    </div>

    <span class="divider"></span>
    
    <div class="form-group">
      <select id="keywordType" name="keywordType" class="form-control">
        {{ select_options(dict('userKeyWordType'), app.request.query.get('keywordType'), '--关键词类型--') }}
      </select>
    </div>

    <div class="form-group">
      <input type="text" id="keyword" name="keyword" class="form-control" value="{{ app.request.query.get('keyword') }}" placeholder="关键词">
    </div>

    <button class="btn btn-primary">搜索</button>

    {% if is_granted('ROLE_SUPER_ADMIN') %}
       {% if showUserExport %}
        <a class="btn btn-primary mhs" id="user-export" data-toggle="modal" data-target="#modal" data-url="{{path('admin_user_export')}}">导出用户</a>

        {% endif %}
    {% endif %}

  </form>

<table id="user-table" class="table table-striped table-hover" data-search-form="#user-search-form">
  <thead>
    <tr>
      <th>用户名</th>
      <th>Email</th>
      <th>注册时间</th>
      <th>最近登录</th>
      <th>操作</th>
    </tr>
  </thead>
  <tbody>
    {% for user in users %}
      {% include 'TopxiaAdminBundle:User:user-table-tr.html.twig' with {user:user} %}
    {% endfor %}
  </tbody>
</table>
 {{ web_macro.paginator(paginator) }} 
{% endblock %}